﻿@model Himall.Web.Areas.Web.Models.ShopHomeModel
@{
    ViewBag.Title = Model.Shop.Name;
    Layout = "~/Areas/Web/Views/Shared/ShopLayout.cshtml";
}
@section Script{
    <script type="text/javascript">
        var IsExpired="@ViewBag.IsExpired";
        //焦点图渐变切换
        $(function () {
            var len = $(".shop-focus ul li").length;
            var index = 0;
            var picTimer;
            var btn = '<ol>';
            for (var i = 1; i <= len; i++) {
                btn += "<li>" + i + "</li>";
            }
            btn += "</ol>";
            $('.shop-focus').append(btn);
            $(".shop-focus ul li").eq(0).show();
            $(".shop-focus ol li").mouseover(function () {
                index = $(".shop-focus ol li").index(this);
                showPics(index);
            }).eq(0).trigger("mouseover");

            $(".shop-focus ul").hover(function () {
                clearInterval(picTimer);
            }, function () {
                picTimer = setInterval(function () {
                    showPics(index);
                    index++;
                    if (index == len) { index = 0; }
                }, 3000);
            }).trigger("mouseleave");

            function showPics(index) {
                $(".shop-focus ul li").eq(index).fadeIn().siblings().fadeOut();
                $(".shop-focus ol li").removeClass("cur").eq(index).addClass("cur");
            }

            if(IsExpired=="True"){
                $.dialog.errorTips('该店铺已过期！','',5000)
            }
        });
    </script>
}
<div class="shop-right">
    <div class="shop-focus">
        <ul>
            @{
                foreach (var item in Model.Slides)
                {
                    var style = Model.Slides.IndexOf(item) == 1 ? "display:block;" : "";
                    <li style="@style"><a target="_blank" href="/@item.Url"><img class="lazyload" src="~/Areas/Web/images/blank.gif" data-url="@item.ImageUrl" alt="" /></a></li>
                }
                if (null == Model.Slides || Model.Slides.Count() == 0)
                {
                    <li><a target="_blank" href="#"><img class="lazyload" src="~/Areas/Web/images/blank.gif" data-url="http://fpoimg.com/990x350" alt="" /></a></li>
                }
            }

        </ul>
    </div>
    <div class="shop-recommend">
        <ul class="cl">
            @for (int i = 1; i < Model.ImageAds.Count(); i++)
            {
                var _url = string.IsNullOrWhiteSpace(Model.ImageAds.ElementAt(i).ImageUrl) ? "http://fpoimg.com/325x325" : Model.ImageAds.ElementAt(i).ImageUrl;
                <li><a target="_blank" href="@Model.ImageAds.ElementAt(i).Url"><img class="lazyload" src="~/Areas/Web/images/blank.gif" data-url="@_url" alt="" /></a></li>
            }
        </ul>
    </div>

    @foreach (var floor in Model.Floors)
    {
        <div class="shop-goods-list">
            <strong class="list-title">@floor.FloorName</strong>
            <ul class="cl">
                @foreach (var p in floor.Products)
                {

                    <li>
                        <a target="_blank" href="@Url.Action("Detail", "Product", new { id = p.Id })">
                            <img class="lazyload" src="~/Areas/Web/images/blank.gif" data-url="@p.Pic/1_220.png" alt="" />
                        </a>
                        <h3><a target="_blank" href="@Url.Action("Detail", "Product", new { id = p.Id })">@p.Name</a></h3>
                        <p><span>￥@p.Price</span></p>
                        <p>已售@(p.SaleCount)件</p>
                    </li>
                }
            </ul>
        </div>
    }
</div>
